var menuItems = document.querySelectorAll('.menu-list li')
var menuLineList = document.querySelectorAll('.menu-list li div')
console.log(menuLineList)
for (var i = 0; i < menuItems.length; i++){
    menuItems[i].onclick = function (event) {
        console.log(event.target)
        console.log(event.target.childNodes)
        console.log(event.target.children)
        // 清空所有的li的class类
        removeClass(menuItems)
        // 给当前点击的li添加active类

        // event.target.className = 'active'
        this.className = 'active'

        removeRotate(menuLineList)

        event.target.children[0].style.transform = 'rotateY(0deg)'
    }
}

function removeClass (elements) {
    for (var i = 0; i < elements.length; i++) {
        elements[i].className = ''
    }
}

function removeRotate (elements) {
    for (var i = 0; i < elements.length; i++) {
        elements[i].style.transform = 'rotateY(90deg)'
    }
}
